import api from './auth.js'

// 订单相关API
export const orderAPI = {
  // 获取当前用户的订单列表
  getUserOrders: (params) => {
    return api.get('/orders', { params })
  },

  // 获取订单详情
  getOrderDetail: (orderId) => {
    return api.get(`/orders/${orderId}`)
  },

  // 创建订单
  createOrder: (orderData) => {
    return api.post('/orders', orderData)
  },

  // 支付订单
  payOrder: (orderId, payData) => {
    return api.post(`/orders/${orderId}/pay`, payData)
  },

  // 确认收货
  confirmOrder: (orderId) => {
    return api.post(`/orders/${orderId}/confirm`)
  },

  // 取消订单
  cancelOrder: (orderId, reason) => {
    return api.post(`/orders/${orderId}/cancel`, { reason })
  },

  // 获取订单统计数据
  getOrderStats: () => {
    return api.get('/orders/stats')
  }
}

export default orderAPI 